package com.ctshk.rpc.scenic.service.impl.app;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ctshk.common.dto.Result;
import com.ctshk.common.model.PageResponse;
import com.ctshk.common.utils.EntityUtil;
import com.ctshk.common.utils.thirdparty.TicketInternalApiUtil;
import com.ctshk.common.utils.thirdparty.airshowReq.PackageProductsReq;
import com.ctshk.common.utils.thirdparty.airshowResp.AirshowSceneResp;
import com.ctshk.common.utils.thirdparty.airshowResp.AirshowTicketResp;
import com.ctshk.common.utils.thirdparty.airshowResp.PackageProductResp;
import com.ctshk.rpc.scenic.dto.AirshowProductDTO;
import com.ctshk.rpc.scenic.dto.app.ScenicProductDTO;
import com.ctshk.rpc.scenic.entity.app.ScenicProductApp;
import com.ctshk.rpc.scenic.mapper.app.ScenicProductAppMapper;
import com.ctshk.rpc.scenic.req.AirshowProductListReq;
import com.ctshk.rpc.scenic.service.app.IAirshowAppService;
import com.ctshk.rpc.scenic.service.app.IScenicProductAppService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService
public class AirshowAppServiceImpl implements IAirshowAppService {

    @Override
    public Result<List<AirshowSceneResp>> getScene() {

        String s = TicketInternalApiUtil.sendGet(TicketInternalApiUtil.URL + "/crm/order/scenic/airshow-api/get-ticket-scene", "");

        return JSONObject.parseObject(s,new TypeReference<Result<List<AirshowSceneResp>>>(){});
    }

    @Override
    public Result<List<AirshowTicketResp>> getTicketBySceneId(Long sceneId) {

        String s = TicketInternalApiUtil.sendGet(TicketInternalApiUtil.URL + "/crm/order/scenic/airshow-api/get-ticket-by-scene-id", "sceneId="+sceneId);

        return JSONObject.parseObject(s,new TypeReference<Result<List<AirshowTicketResp>>>(){});
    }

    @Override
    public PageResponse<AirshowProductDTO> getPackageProductListByParams(AirshowProductListReq airshowProductReq) {

        String s1 = JSONObject.toJSONString(airshowProductReq);

        String s = TicketInternalApiUtil.sendPost(TicketInternalApiUtil.URL + "/crm/order/scenic/airshow-api/get-package-products", s1);

        return JSONObject.parseObject(s,new TypeReference<PageResponse<AirshowProductDTO>>(){});
    }
}
